package com.example.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

@Configuration
@ComponentScan("com.example")
public class AppConfig {

    @Bean(name = "threadPoolExecutor")
    public ExecutorService threadPoolExecutor() {
        // 创建一个固定大小的线程池，包含3个线程
        return Executors.newFixedThreadPool(3);
    }
}